{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python37764bit5d211478a4cf4a3d93a2c891f6a9207d",
   "display_name": "Python 3.7.7 64-bit"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": "TIME is something we can never hedge\nUPPER CASE 4\nLOWER CASE 26\n"
    }
   ],
   "source": [
    "'''\n",
    "Question 14\n",
    "\n",
    "Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.\n",
    "Suppose the following input is supplied to the program:\n",
    "\n",
    "Hello world!\n",
    "\n",
    "Then, the output should be:\n",
    "\n",
    "UPPER CASE 1\n",
    "LOWER CASE 9\n",
    "'''\n",
    "\n",
    "x = input()\n",
    "up_c, low_c = 0, 0\n",
    "for i in x:\n",
    "    if i.isupper():\n",
    "        up_c += 1\n",
    "    elif i.islower():\n",
    "        low_c += 1\n",
    "\n",
    "print(x)\n",
    "print(\"UPPER CASE {0}\\nLOWER CASE {1}\".format(up_c,low_c))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": "11106\n"
    }
   ],
   "source": [
    "'''\n",
    "Question 15\n",
    "Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the value of a.\n",
    "\n",
    "Suppose the following input is supplied to the program:\n",
    "\n",
    "9\n",
    "\n",
    "Then, the output should be:\n",
    "\n",
    "11106\n",
    "'''\n",
    "\n",
    "x = input() # CAUTION: input()-> str\n",
    "lst = []\n",
    "try:\n",
    "    for i in range(1,5):\n",
    "        lst.append(x*i)\n",
    "    print(sum(map(int,lst)))\n",
    "except:\n",
    "    print('我只会算算数')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}